package com.itheima.aimobile.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.itheima.aimobile.domain.UserInfo;
import com.itheima.aimobile.mapper.UserInfoMapper;
import com.itheima.aimobile.service.IUserInfoService;
import org.springframework.stereotype.Service;

@Service
public class UserInfoServiceImpl extends ServiceImpl<UserInfoMapper, UserInfo> implements IUserInfoService {

    @Override
    public UserInfo getUserByPhone(String phone) {
        // 使用QueryWrapper条件查询
        QueryWrapper<UserInfo> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("phone", phone); // 等价于 SQL: WHERE phone = ?
        return baseMapper.selectOne(queryWrapper); // 调用Mapper查询
    }
}
